<%@ 
page 
language="java" 
import="java.util.*,com.csd.pojo.Message" 
import="com.csd.helper.Tool"
pageEncoding="utf-8"
%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
List<Message> newMsg = (List<Message>)request.getAttribute("newMessageList");
List<Message> oldMsg = (List<Message>)request.getAttribute("oldMessageList");

Integer currPage = (Integer)request.getAttribute("currPage");
Integer totalPage = (Integer)request.getAttribute("totalPage");

if(currPage == null || currPage <= 0 )
	currPage = 1;
	
if(totalPage == null || totalPage <= 0)
	totalPage = 1;
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Message Recv</title>
<link href="<%=path %>/common/css/rpms_right.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div class="main">
        <h1>你的消息</h1>
        <hr />
        <h3>新的消息</h3>
        <table width="100%">
            <tr>
            
                <td class="table_head" width="200px">主题</td>
                <td class="table_head" width="100px">发送时间</td>
                <td class="table_head" width="100px">发送者</td>     
                <td class="table_head">操作</td>    
            </tr>
            <%if(newMsg != null && newMsg.size()>0) {%>
            <%for(Message i : newMsg){ %>
                <tr>
                <td> <%=i.getTitle() %></td>
                <td> <%=Tool.dateToString( i.getTime() ) %></td>
                <td> <%=i.getSenderid() %></td>
                <td>
                	<a href='<%=path %>/messageDetail.action?messageID=<%=i.getId() %>'>查看</a>
                	/<a href="<%=path %>/common/sendMsg.jsp?receiverID=<%=i.getSenderid() %>">回复</a>
               		
                </td>
           		</tr>
           	<%} %>
			<%}else{ %>
				<tr>
					<td colspan="4" align="center">暂无消息</td>
				</tr>
			<%} %>
         </table>
        <h3>旧的消息</h3>        
        <table width="100%">
            <tr>            
                <td class="table_head" width="200px">主题</td>
                <td class="table_head" width="100px">发送时间</td>
                <td class="table_head" width="100px">发送者</td>     
                <td class="table_head">操作</td>    
            </tr>
            <%if(oldMsg != null && oldMsg.size()>0) {%>
            <%for(Message i : oldMsg){ %>
                <tr>
                <td> <%=i.getTitle() %></td>
                <td> <%=Tool.dateToString(i.getTime()) %></td>
                <td> <%=i.getSenderid() %></td>
                <td>
                	<a href='<%=path %>/messageDetail.action?messageID=<%=i.getId() %>'>查看</a>
                	/<a href="<%=path %>/common/sendMsg.jsp?receiverID=<%=i.getSenderid() %>">回复</a>
               		
                </td>
           		</tr>
           	<%} %>
			<%}else{ %>
				<tr>
					<td colspan="4" align="center">暂无消息</td>
				</tr>
			<%} %>
			<tr>
				<td colspan="4">
					<%if(currPage > 1){%>
					<a href="<%=path %>/messageList.action?currPage=1">首页</a> |
					<a href="<%=path %>/messageList.action?currPage=<%=currPage-1 %>">上一页</a> |
					<%} %>
					<span> 页面: <%=currPage %> </span>
					<%if(currPage < totalPage){%>
					| <a href="<%=path %>/messageList.action?currPage=<%=currPage+1 %>">下一页</a>
					| <a href="<%=path %>/messageList.action?currPage=<%=totalPage %>">尾页</a>
					<%} %>
				</td>
			</tr>
      
        </table>
    </div>
</body>
</html>

